<?php
require('tools.php');
$result_data = array("code" => "3000", "msg" => "删除失败!原因未知!");
if (isset($table_name)) {
    if (isset($uuid_key)) {
        if (isset($uuid_val)) {
            if (SQLTools::rowTB($conn, $table_name, "${uuid_key}='${uuid_val}'") < 1) {
                $result_data["code"] = "3001";
                $result_data["msg"] = "删除失败,要删除的数据不存在!";
            } else {
                if (SQLTools::deleteTB($conn, $table_name, "${uuid_key}='${uuid_val}'")) {
                    $result_data["code"] = "2000";
                    $result_data["msg"] = "删除成功!";
                } else {
                    $result_data["code"] = "3006";
                    $result_data["msg"] = "执行删除指令失败!";
                }
            }
        } else {
            $result_data["code"] = "3005";
            $result_data["msg"] = "删除失败,要删除的uuid_val不存在!";
        }
    } else {
        $result_data["code"] = "3004";
        $result_data["msg"] = "删除失败,要删除的uuid_key不存在!";
    }
} else {
    $result_data["code"] = "3003";
    $result_data["msg"] = "删除失败,要删除的表名错误!";
}
echo json_encode($result_data);
